]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
panelMenu: Interact to touch events
authorCarlos Garnacho <carlosg@gnome.org>
Tue, 22 Jul 2014 10:28:00 +0000 (12:28 +0200)
committerCarlos Garnacho <carlosg@gnome.org>
Thu, 24 Jul 2014 16:15:02 +0000 (18:15 +0200)
No sequence checks are done, these UI elements promptly trigger a grab that
will cancel ongoing touches and redirect later ones somewhere else, so that
works as a barrier to multi-toggling.

https://bugzilla.gnome.org/show_bug.cgi?id=733633

js/ui/panelMenu.js

index 07494d181532986a7651b4ec909a0065f333f9fd..863e0d7ede13a91f9c5fa79caa97b519525902d0 100644 (file)
@@ -100,7 +100,7 @@ const Button = new Lang.Class({
                       accessible_name: nameText ? nameText : "",
                       accessible_role: Atk.Role.MENU });
 
-        this.actor.connect('button-press-event', Lang.bind(this, this._onButtonPress));
+        this.actor.connect('event', Lang.bind(this, this._onEvent));
         this.actor.connect('key-press-event', Lang.bind(this, this._onSourceKeyPress));
         this.actor.connect('notify::visible', Lang.bind(this, this._onVisibilityChanged));
 
@@ -131,11 +131,12 @@ const Button = new Lang.Class({
         }
     },
 
-    _onButtonPress: function(actor, event) {
-        if (!this.menu)
-            return Clutter.EVENT_PROPAGATE;
+    _onEvent: function(actor, event) {
+        if (this.menu &&
+            (event.type() == Clutter.EventType.TOUCH_BEGIN ||
+             event.type() == Clutter.EventType.BUTTON_PRESS))
+            this.menu.toggle();
 
-        this.menu.toggle();
         return Clutter.EVENT_PROPAGATE;
     },